\documentclass[a4paper]{article}

\usepackage{listings}

\lstset{language=Java,
basicstyle=\footnotesize,
tabsize=2,
%numbers=left,
numbersep=2pt,                  % how far the line-numbers are from the code
breaklines=true,
showspaces=false,               % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
xleftmargin=15pt,
columns=flexible
}

\begin{document}

\section{Appendix A Test Result Data}
\subsection{Tagging objects without expansion}
\label{sec:testresultdata-correctness}
Please note that all the tests below as an input create network consisting of only 10 nodes with index retraction and index expansion limits equal to 5 and 10, respectively.

\paragraph{Input values} 
Tag 5 objects in total under \textit{news} tag and \textit{urls} category and 
later search by specified tag.

\paragraph{Expected output}
Since we do not consider any expansion in this scenario, we expect to observe only messages related
to tagging and searching i.e. TagMsg, ResultsMsg, SearchMsg.

\paragraph{Actual result}
\lstinputlisting{test_results/correctness_testTagObjectNoExpansion.txt}

\paragraph{Result discussion}
The expected output indeed contains required messages and none of the forbidden messages. 
Test results shows also that the system is able to retrieve complete set of data that has been stored 
in the beginning of our test.

\subsection{Tagging objects with expansion}

\paragraph{Input values}
Tag 11 objects in total under \textit{news} tag and \textit{urls} category and 
later search by specified tag.

\paragraph{Expected output}
In this scenario we expect the index expansion algorithm to take place, thus besides standard
messages like TagMsg, ResultsMsg and SearchMsgs we should be able to observe IndexExpansionRequestMsg
and IndexExpansionConfirmationMsg messages.

\paragraph{Actual result}
\lstinputlisting{test_results/correctnes_testTagObject.txt}

\paragraph{Result discussion}
The actual result indeed contains expected messages i.e. we can see subsequent calls to \texttt{TagMsg},
as well as calls to \texttt{IndexExpansionMsg}. One can also observe that with each expansion message
there is a call to process a \texttt{IndexConfirmationMsg}. 
Since for this test case we had only a small
amount of nodes in the network ring and quite a lot of data, some messages during the tagging process
had to be buffered. This process is also reflected in the final output.

\subsection{Untagging objects}

\paragraph{Input values} 
In this test we tag the same object under the same url and type twice and later call \textit{untag} 
operation also twice together with \textit{search} method.

\paragraph{Expected output}
Expected output should contain information that object has been successfully tagged and that
after first call to untag and search methods we should observe that result contain indeed 
mentioned object but with \textit{rank} value equal to 1. While the second call should only
confirm that the object has been removed from the system, but the actual result should not be
returned to the client.

\paragraph{Actual result}
\lstinputlisting{test_results/correctnes_testUnTagObject.txt}

\paragraph{Result discussion}
Actual result is indeed consistent in relation to what we has been defined in expected output.
First we can observe proper result set i.e. with decremented rank, while after processing
second UnTag message we obtain empty result set. 

\subsection{Searching data}
Correctness of searching for an object has been partly tested by tagging and untagging test cases,
however, in this section we test multi keyword searching.

\paragraph{Input values} 
For the input values we provide two different objects that are tagged under the same category,
but under different tag name i.e. \textit{news} and \textit{sport}.

\paragraph{Expected output}
Our expectation is to get all the the results related to both news and sport tags.
% Additionally, in the
%end we would like to see results obtained for query of news but \textit{not} sport.

\paragraph{Actual result}
\lstinputlisting{test_results/correctness_testSearching.txt}

\paragraph{Result discussion}
Results obtained after searching our system with specified query return proper result set.
Query involving multi keyword has been processed correctly.

%\subsubsection{Leaf set replication}
%
%\paragraph{Input values} 
%We basically tag certain object a few times.
%
%\paragraph{Expected output}
%Expected should be messages logging information about start and stop of the replication
%procedure, together with messages related to storing object in the system.
%
%\paragraph{Actual result}
%\textbf{TBD}

%\paragraph{Result discussion}
%\end{document}